"""
    Pinterest REST API

    Pinterest's REST API  # noqa: E501

    The version of the OpenAPI document: 5.6.0
    Contact: pinterest-api@pinterest.com
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from pinterest.generated.client.api_client import ApiClient, Endpoint as _Endpoint
from pinterest.generated.client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from pinterest.generated.client.model.error import Error
from pinterest.generated.client.model.granularity import Granularity
from pinterest.generated.client.model.product_group_analytics_response import ProductGroupAnalyticsResponse
from pinterest.generated.client.model.product_group_promotion import ProductGroupPromotion
from pinterest.generated.client.model.product_group_promotion_array_response import ProductGroupPromotionArrayResponse
from pinterest.generated.client.model.product_group_promotion_create_request import ProductGroupPromotionCreateRequest
from pinterest.generated.client.model.product_group_promotion_update_request import ProductGroupPromotionUpdateRequest
from pinterest.generated.client.model.product_group_promotion_update_response_item import ProductGroupPromotionUpdateResponseItem


class ProductGroupPromotionsApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client
        self.product_group_promotion_get_endpoint = _Endpoint(
            settings={
                'response_type': (ProductGroupPromotion,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/ad_accounts/{ad_account_id}/product_group_promotions/{product_group_promotion_id}',
                'operation_id': 'product_group_promotion_get',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'ad_account_id',
                    'product_group_promotion_id',
                ],
                'required': [
                    'ad_account_id',
                    'product_group_promotion_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'ad_account_id',
                    'product_group_promotion_id',
                ]
            },
            root_map={
                'validations': {
                    ('ad_account_id',): {
                        'max_length': 18,
                        'regex': {
                            'pattern': r'^\d+$',  # noqa: E501
                        },
                    },
                    ('product_group_promotion_id',): {
                        'max_length': 18,
                        'regex': {
                            'pattern': r'^\d+$',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'ad_account_id':
                        (str,),
                    'product_group_promotion_id':
                        (str,),
                },
                'attribute_map': {
                    'ad_account_id': 'ad_account_id',
                    'product_group_promotion_id': 'product_group_promotion_id',
                },
                'location_map': {
                    'ad_account_id': 'path',
                    'product_group_promotion_id': 'path',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )
        self.product_group_promotions_create_endpoint = _Endpoint(
            settings={
                'response_type': (ProductGroupPromotionArrayResponse,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/ad_accounts/{ad_account_id}/product_group_promotions',
                'operation_id': 'product_group_promotions_create',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'ad_account_id',
                    'product_group_promotion_create_request',
                ],
                'required': [
                    'ad_account_id',
                    'product_group_promotion_create_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'ad_account_id',
                ]
            },
            root_map={
                'validations': {
                    ('ad_account_id',): {
                        'max_length': 18,
                        'regex': {
                            'pattern': r'^\d+$',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'ad_account_id':
                        (str,),
                    'product_group_promotion_create_request':
                        (ProductGroupPromotionCreateRequest,),
                },
                'attribute_map': {
                    'ad_account_id': 'ad_account_id',
                },
                'location_map': {
                    'ad_account_id': 'path',
                    'product_group_promotion_create_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.product_group_promotions_update_endpoint = _Endpoint(
            settings={
                'response_type': ([ProductGroupPromotionUpdateResponseItem],),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/ad_accounts/{ad_account_id}/product_group_promotions',
                'operation_id': 'product_group_promotions_update',
                'http_method': 'PATCH',
                'servers': None,
            },
            params_map={
                'all': [
                    'ad_account_id',
                    'product_group_promotion_update_request',
                ],
                'required': [
                    'ad_account_id',
                    'product_group_promotion_update_request',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                    'ad_account_id',
                ]
            },
            root_map={
                'validations': {
                    ('ad_account_id',): {
                        'max_length': 18,
                        'regex': {
                            'pattern': r'^\d+$',  # noqa: E501
                        },
                    },
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'ad_account_id':
                        (str,),
                    'product_group_promotion_update_request':
                        (ProductGroupPromotionUpdateRequest,),
                },
                'attribute_map': {
                    'ad_account_id': 'ad_account_id',
                },
                'location_map': {
                    'ad_account_id': 'path',
                    'product_group_promotion_update_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client
        )
        self.product_groups_analytics_endpoint = _Endpoint(
            settings={
                'response_type': (ProductGroupAnalyticsResponse,),
                'auth': [
                    'pinterest_oauth2'
                ],
                'endpoint_path': '/ad_accounts/{ad_account_id}/product_groups/analytics',
                'operation_id': 'product_groups_analytics',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'ad_account_id',
                    'start_date',
                    'end_date',
                    'product_group_ids',
                    'columns',
                    'granularity',
                    'click_window_days',
                    'engagement_window_days',
                    'view_window_days',
                    'conversion_report_time',
                ],
                'required': [
                    'ad_account_id',
                    'start_date',
                    'end_date',
                    'product_group_ids',
                    'columns',
                    'granularity',
                ],
                'nullable': [
                ],
                'enum': [
                    'columns',
                    'click_window_days',
                    'engagement_window_days',
                    'view_window_days',
                    'conversion_report_time',
                ],
                'validation': [
                    'ad_account_id',
                    'product_group_ids',
                ]
            },
            root_map={
                'validations': {
                    ('ad_account_id',): {
                        'max_length': 18,
                        'regex': {
                            'pattern': r'^\d+$',  # noqa: E501
                        },
                    },
                    ('product_group_ids',): {

                        'max_items': 100,
                        'min_items': 1,
                    },
                },
                'allowed_values': {
                    ('columns',): {

                        "ADVERTISER_ID": "ADVERTISER_ID",
                        "PIN_PROMOTION_ID": "PIN_PROMOTION_ID",
                        "AD_ACCOUNT_ID": "AD_ACCOUNT_ID",
                        "AD_GROUP_ENTITY_STATUS": "AD_GROUP_ENTITY_STATUS",
                        "AD_GROUP_ID": "AD_GROUP_ID",
                        "AD_ID": "AD_ID",
                        "CAMPAIGN_DAILY_SPEND_CAP": "CAMPAIGN_DAILY_SPEND_CAP",
                        "CAMPAIGN_ENTITY_STATUS": "CAMPAIGN_ENTITY_STATUS",
                        "CAMPAIGN_ID": "CAMPAIGN_ID",
                        "CAMPAIGN_LIFETIME_SPEND_CAP": "CAMPAIGN_LIFETIME_SPEND_CAP",
                        "CAMPAIGN_NAME": "CAMPAIGN_NAME",
                        "CHECKOUT_ROAS": "CHECKOUT_ROAS",
                        "CLICKTHROUGH_1": "CLICKTHROUGH_1",
                        "CLICKTHROUGH_1_GROSS": "CLICKTHROUGH_1_GROSS",
                        "CLICKTHROUGH_2": "CLICKTHROUGH_2",
                        "CPC_IN_MICRO_DOLLAR": "CPC_IN_MICRO_DOLLAR",
                        "CPM_IN_DOLLAR": "CPM_IN_DOLLAR",
                        "CPM_IN_MICRO_DOLLAR": "CPM_IN_MICRO_DOLLAR",
                        "CTR": "CTR",
                        "CTR_2": "CTR_2",
                        "ECPCV_IN_DOLLAR": "ECPCV_IN_DOLLAR",
                        "ECPCV_P95_IN_DOLLAR": "ECPCV_P95_IN_DOLLAR",
                        "ECPC_IN_DOLLAR": "ECPC_IN_DOLLAR",
                        "ECPC_IN_MICRO_DOLLAR": "ECPC_IN_MICRO_DOLLAR",
                        "ECPE_IN_DOLLAR": "ECPE_IN_DOLLAR",
                        "ECPM_IN_MICRO_DOLLAR": "ECPM_IN_MICRO_DOLLAR",
                        "ECPV_IN_DOLLAR": "ECPV_IN_DOLLAR",
                        "ECTR": "ECTR",
                        "EENGAGEMENT_RATE": "EENGAGEMENT_RATE",
                        "ENGAGEMENT_1": "ENGAGEMENT_1",
                        "ENGAGEMENT_2": "ENGAGEMENT_2",
                        "ENGAGEMENT_RATE": "ENGAGEMENT_RATE",
                        "IDEA_PIN_PRODUCT_TAG_VISIT_1": "IDEA_PIN_PRODUCT_TAG_VISIT_1",
                        "IDEA_PIN_PRODUCT_TAG_VISIT_2": "IDEA_PIN_PRODUCT_TAG_VISIT_2",
                        "IMPRESSION_1": "IMPRESSION_1",
                        "IMPRESSION_1_GROSS": "IMPRESSION_1_GROSS",
                        "IMPRESSION_2": "IMPRESSION_2",
                        "INAPP_CHECKOUT_COST_PER_ACTION": "INAPP_CHECKOUT_COST_PER_ACTION",
                        "OUTBOUND_CLICK_1": "OUTBOUND_CLICK_1",
                        "OUTBOUND_CLICK_2": "OUTBOUND_CLICK_2",
                        "PAGE_VISIT_COST_PER_ACTION": "PAGE_VISIT_COST_PER_ACTION",
                        "PAGE_VISIT_ROAS": "PAGE_VISIT_ROAS",
                        "PAID_IMPRESSION": "PAID_IMPRESSION",
                        "PIN_ID": "PIN_ID",
                        "REPIN_1": "REPIN_1",
                        "REPIN_2": "REPIN_2",
                        "REPIN_RATE": "REPIN_RATE",
                        "SPEND_IN_DOLLAR": "SPEND_IN_DOLLAR",
                        "SPEND_IN_MICRO_DOLLAR": "SPEND_IN_MICRO_DOLLAR",
                        "TOTAL_CHECKOUT": "TOTAL_CHECKOUT",
                        "TOTAL_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_CLICKTHROUGH": "TOTAL_CLICKTHROUGH",
                        "TOTAL_CLICK_ADD_TO_CART": "TOTAL_CLICK_ADD_TO_CART",
                        "TOTAL_CLICK_CHECKOUT": "TOTAL_CLICK_CHECKOUT",
                        "TOTAL_CLICK_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_CLICK_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_CLICK_LEAD": "TOTAL_CLICK_LEAD",
                        "TOTAL_CLICK_SIGNUP": "TOTAL_CLICK_SIGNUP",
                        "TOTAL_CLICK_SIGNUP_VALUE_IN_MICRO_DOLLAR": "TOTAL_CLICK_SIGNUP_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_CONVERSIONS": "TOTAL_CONVERSIONS",
                        "TOTAL_CUSTOM": "TOTAL_CUSTOM",
                        "TOTAL_ENGAGEMENT": "TOTAL_ENGAGEMENT",
                        "TOTAL_ENGAGEMENT_CHECKOUT": "TOTAL_ENGAGEMENT_CHECKOUT",
                        "TOTAL_ENGAGEMENT_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_ENGAGEMENT_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_ENGAGEMENT_LEAD": "TOTAL_ENGAGEMENT_LEAD",
                        "TOTAL_ENGAGEMENT_SIGNUP": "TOTAL_ENGAGEMENT_SIGNUP",
                        "TOTAL_ENGAGEMENT_SIGNUP_VALUE_IN_MICRO_DOLLAR": "TOTAL_ENGAGEMENT_SIGNUP_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_IDEA_PIN_PRODUCT_TAG_VISIT": "TOTAL_IDEA_PIN_PRODUCT_TAG_VISIT",
                        "TOTAL_IMPRESSION_FREQUENCY": "TOTAL_IMPRESSION_FREQUENCY",
                        "TOTAL_IMPRESSION_USER": "TOTAL_IMPRESSION_USER",
                        "TOTAL_LEAD": "TOTAL_LEAD",
                        "TOTAL_OFFLINE_CHECKOUT": "TOTAL_OFFLINE_CHECKOUT",
                        "TOTAL_PAGE_VISIT": "TOTAL_PAGE_VISIT",
                        "TOTAL_REPIN_RATE": "TOTAL_REPIN_RATE",
                        "TOTAL_SIGNUP": "TOTAL_SIGNUP",
                        "TOTAL_SIGNUP_VALUE_IN_MICRO_DOLLAR": "TOTAL_SIGNUP_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_VIDEO_3SEC_VIEWS": "TOTAL_VIDEO_3SEC_VIEWS",
                        "TOTAL_VIDEO_AVG_WATCHTIME_IN_SECOND": "TOTAL_VIDEO_AVG_WATCHTIME_IN_SECOND",
                        "TOTAL_VIDEO_MRC_VIEWS": "TOTAL_VIDEO_MRC_VIEWS",
                        "TOTAL_VIDEO_P0_COMBINED": "TOTAL_VIDEO_P0_COMBINED",
                        "TOTAL_VIDEO_P100_COMPLETE": "TOTAL_VIDEO_P100_COMPLETE",
                        "TOTAL_VIDEO_P25_COMBINED": "TOTAL_VIDEO_P25_COMBINED",
                        "TOTAL_VIDEO_P50_COMBINED": "TOTAL_VIDEO_P50_COMBINED",
                        "TOTAL_VIDEO_P75_COMBINED": "TOTAL_VIDEO_P75_COMBINED",
                        "TOTAL_VIDEO_P95_COMBINED": "TOTAL_VIDEO_P95_COMBINED",
                        "TOTAL_VIEW_ADD_TO_CART": "TOTAL_VIEW_ADD_TO_CART",
                        "TOTAL_VIEW_CHECKOUT": "TOTAL_VIEW_CHECKOUT",
                        "TOTAL_VIEW_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_VIEW_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_VIEW_LEAD": "TOTAL_VIEW_LEAD",
                        "TOTAL_VIEW_SIGNUP": "TOTAL_VIEW_SIGNUP",
                        "TOTAL_VIEW_SIGNUP_VALUE_IN_MICRO_DOLLAR": "TOTAL_VIEW_SIGNUP_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_WEB_CHECKOUT": "TOTAL_WEB_CHECKOUT",
                        "TOTAL_WEB_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_WEB_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_WEB_CLICK_CHECKOUT": "TOTAL_WEB_CLICK_CHECKOUT",
                        "TOTAL_WEB_CLICK_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_WEB_CLICK_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_WEB_ENGAGEMENT_CHECKOUT": "TOTAL_WEB_ENGAGEMENT_CHECKOUT",
                        "TOTAL_WEB_ENGAGEMENT_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_WEB_ENGAGEMENT_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "TOTAL_WEB_SESSIONS": "TOTAL_WEB_SESSIONS",
                        "TOTAL_WEB_VIEW_CHECKOUT": "TOTAL_WEB_VIEW_CHECKOUT",
                        "TOTAL_WEB_VIEW_CHECKOUT_VALUE_IN_MICRO_DOLLAR": "TOTAL_WEB_VIEW_CHECKOUT_VALUE_IN_MICRO_DOLLAR",
                        "VIDEO_3SEC_VIEWS_2": "VIDEO_3SEC_VIEWS_2",
                        "VIDEO_LENGTH": "VIDEO_LENGTH",
                        "VIDEO_MRC_VIEWS_2": "VIDEO_MRC_VIEWS_2",
                        "VIDEO_P0_COMBINED_2": "VIDEO_P0_COMBINED_2",
                        "VIDEO_P100_COMPLETE_2": "VIDEO_P100_COMPLETE_2",
                        "VIDEO_P25_COMBINED_2": "VIDEO_P25_COMBINED_2",
                        "VIDEO_P50_COMBINED_2": "VIDEO_P50_COMBINED_2",
                        "VIDEO_P75_COMBINED_2": "VIDEO_P75_COMBINED_2",
                        "VIDEO_P95_COMBINED_2": "VIDEO_P95_COMBINED_2",
                        "WEB_CHECKOUT_COST_PER_ACTION": "WEB_CHECKOUT_COST_PER_ACTION",
                        "WEB_CHECKOUT_ROAS": "WEB_CHECKOUT_ROAS",
                        "WEB_SESSIONS_1": "WEB_SESSIONS_1",
                        "WEB_SESSIONS_2": "WEB_SESSIONS_2"
                    },
                    ('click_window_days',): {

                        "1": 1,
                        "7": 7,
                        "30": 30,
                        "60": 60
                    },
                    ('engagement_window_days',): {

                        "1": 1,
                        "7": 7,
                        "30": 30,
                        "60": 60
                    },
                    ('view_window_days',): {

                        "1": 1,
                        "7": 7,
                        "30": 30,
                        "60": 60
                    },
                    ('conversion_report_time',): {

                        "AD_ACTION": "TIME_OF_AD_ACTION",
                        "CONVERSION": "TIME_OF_CONVERSION"
                    },
                },
                'openapi_types': {
                    'ad_account_id':
                        (str,),
                    'start_date':
                        (date,),
                    'end_date':
                        (date,),
                    'product_group_ids':
                        ([str],),
                    'columns':
                        ([str],),
                    'granularity':
                        (Granularity,),
                    'click_window_days':
                        (int,),
                    'engagement_window_days':
                        (int,),
                    'view_window_days':
                        (int,),
                    'conversion_report_time':
                        (str,),
                },
                'attribute_map': {
                    'ad_account_id': 'ad_account_id',
                    'start_date': 'start_date',
                    'end_date': 'end_date',
                    'product_group_ids': 'product_group_ids',
                    'columns': 'columns',
                    'granularity': 'granularity',
                    'click_window_days': 'click_window_days',
                    'engagement_window_days': 'engagement_window_days',
                    'view_window_days': 'view_window_days',
                    'conversion_report_time': 'conversion_report_time',
                },
                'location_map': {
                    'ad_account_id': 'path',
                    'start_date': 'query',
                    'end_date': 'query',
                    'product_group_ids': 'query',
                    'columns': 'query',
                    'granularity': 'query',
                    'click_window_days': 'query',
                    'engagement_window_days': 'query',
                    'view_window_days': 'query',
                    'conversion_report_time': 'query',
                },
                'collection_format_map': {
                    'product_group_ids': 'multi',
                    'columns': 'csv',
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client
        )

    def product_group_promotion_get(
        self,
        ad_account_id,
        product_group_promotion_id,
        **kwargs
    ):
        """Get a product group promotion by id  # noqa: E501

        Get a product group promotion by id  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.product_group_promotion_get(ad_account_id, product_group_promotion_id, async_req=True)
        >>> result = thread.get()

        Args:
            ad_account_id (str): Unique identifier of an ad account.
            product_group_promotion_id (str): Unique identifier of a product group promotion

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            ProductGroupPromotion
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['ad_account_id'] = \
            ad_account_id
        kwargs['product_group_promotion_id'] = \
            product_group_promotion_id
        return self.product_group_promotion_get_endpoint.call_with_http_info(**kwargs)

    def product_group_promotions_create(
        self,
        ad_account_id,
        product_group_promotion_create_request,
        **kwargs
    ):
        """Create product group promotions  # noqa: E501

        Add one or more product groups from your catalog to an existing ad group. (Product groups added to an ad group are a 'product group promotion.')  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.product_group_promotions_create(ad_account_id, product_group_promotion_create_request, async_req=True)
        >>> result = thread.get()

        Args:
            ad_account_id (str): Unique identifier of an ad account.
            product_group_promotion_create_request (ProductGroupPromotionCreateRequest): List of Product Group Promotions to create, size limit [1, 30].

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            ProductGroupPromotionArrayResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['ad_account_id'] = \
            ad_account_id
        kwargs['product_group_promotion_create_request'] = \
            product_group_promotion_create_request
        return self.product_group_promotions_create_endpoint.call_with_http_info(**kwargs)

    def product_group_promotions_update(
        self,
        ad_account_id,
        product_group_promotion_update_request,
        **kwargs
    ):
        """Update product group promotions  # noqa: E501

        Update multiple existing Product Group Promotions (by product_group_id)  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.product_group_promotions_update(ad_account_id, product_group_promotion_update_request, async_req=True)
        >>> result = thread.get()

        Args:
            ad_account_id (str): Unique identifier of an ad account.
            product_group_promotion_update_request (ProductGroupPromotionUpdateRequest): Parameters to update Product group promotions

        Keyword Args:
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            [ProductGroupPromotionUpdateResponseItem]
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['ad_account_id'] = \
            ad_account_id
        kwargs['product_group_promotion_update_request'] = \
            product_group_promotion_update_request
        return self.product_group_promotions_update_endpoint.call_with_http_info(**kwargs)

    def product_groups_analytics(
        self,
        ad_account_id,
        start_date,
        end_date,
        product_group_ids,
        columns,
        granularity,
        **kwargs
    ):
        """Get product group analytics  # noqa: E501

        Get analytics for the specified product groups in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.product_groups_analytics(ad_account_id, start_date, end_date, product_group_ids, columns, granularity, async_req=True)
        >>> result = thread.get()

        Args:
            ad_account_id (str): Unique identifier of an ad account.
            start_date (date): Metric report start date (UTC). Format: YYYY-MM-DD
            end_date (date): Metric report end date (UTC). Format: YYYY-MM-DD
            product_group_ids ([str]): List of Product group Ids to use to filter the results.
            columns ([str]): Columns to retrieve, encoded as a comma-separated string. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile's currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it's microdollars. Otherwise, it's in microunits of the advertiser's currency.<br/>For example, if the advertiser's currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).<br/>If a column has no value, it may not be returned
            granularity (Granularity): TOTAL - metrics are aggregated over the specified date range.<br> DAY - metrics are broken down daily.<br> HOUR - metrics are broken down hourly.<br>WEEKLY - metrics are broken down weekly.<br>MONTHLY - metrics are broken down monthly

        Keyword Args:
            click_window_days (int): Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days.. [optional] if omitted the server will use the default value of 30
            engagement_window_days (int): Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `30` days.. [optional] if omitted the server will use the default value of 30
            view_window_days (int): Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to `1` day.. [optional] if omitted the server will use the default value of 1
            conversion_report_time (str): The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.. [optional] if omitted the server will use the default value of "TIME_OF_AD_ACTION"
            _return_http_data_only (bool): response data without head status
                code and headers. Default is True.
            _preload_content (bool): if False, the urllib3.HTTPResponse object
                will be returned without reading/decoding response data.
                Default is True.
            _request_timeout (int/float/tuple): timeout setting for this request. If
                one number provided, it will be total request timeout. It can also
                be a pair (tuple) of (connection, read) timeouts.
                Default is None.
            _check_input_type (bool): specifies if type checking
                should be done one the data sent to the server.
                Default is True.
            _check_return_type (bool): specifies if type checking
                should be done one the data received from the server.
                Default is True.
            _spec_property_naming (bool): True if the variable names in the input data
                are serialized names, as specified in the OpenAPI document.
                False if the variable names in the input data
                are pythonic names, e.g. snake case (default)
            _content_type (str/None): force body content-type.
                Default is None and content-type will be predicted by allowed
                content-types and body.
            _host_index (int/None): specifies the index of the server
                that we want to use.
                Default is read from the configuration.
            async_req (bool): execute request asynchronously

        Returns:
            ProductGroupAnalyticsResponse
                If the method is called asynchronously, returns the request
                thread.
        """
        kwargs['async_req'] = kwargs.get(
            'async_req', False
        )
        kwargs['_return_http_data_only'] = kwargs.get(
            '_return_http_data_only', True
        )
        kwargs['_preload_content'] = kwargs.get(
            '_preload_content', True
        )
        kwargs['_request_timeout'] = kwargs.get(
            '_request_timeout', None
        )
        kwargs['_check_input_type'] = kwargs.get(
            '_check_input_type', True
        )
        kwargs['_check_return_type'] = kwargs.get(
            '_check_return_type', True
        )
        kwargs['_spec_property_naming'] = kwargs.get(
            '_spec_property_naming', False
        )
        kwargs['_content_type'] = kwargs.get(
            '_content_type')
        kwargs['_host_index'] = kwargs.get('_host_index')
        kwargs['ad_account_id'] = \
            ad_account_id
        kwargs['start_date'] = \
            start_date
        kwargs['end_date'] = \
            end_date
        kwargs['product_group_ids'] = \
            product_group_ids
        kwargs['columns'] = \
            columns
        kwargs['granularity'] = \
            granularity
        return self.product_groups_analytics_endpoint.call_with_http_info(**kwargs)

